/**
 * Created by chenxiaopeng on 2018/3/6.
 */
import React from 'react';
import { connect } from 'dva';
import { Result, WhiteSpace } from 'antd-mobile';
import CustomIcon from '../components/CustomIcon';
import './SuccessPage.less';

function SuccessPage() {
  function isWeChat() {
    const ua = navigator.userAgent.toLowerCase(); // eslint-disable-line
    if (ua.match(/MicroMessenger/i) == 'micromessenger') { // eslint-disable-line
      return true;
    } else {
      return false;
    }
  }

  function isAliPay() {
    const userAgent = navigator.userAgent.toLowerCase(); // eslint-disable-line

    if (userAgent.match(/Alipay/i) == 'alipay') { // eslint-disable-line
      return true;
    } else {
      return false;
    }
  }

  function getIcon() {
    if (isWeChat()) {
      return require('../svg/wechat.svg');
    } else if (isAliPay()) {
      return require('../svg/alipay.svg');
    }
  }

  return (
    <div>
      <div className="sub-title">支付成功</div>
      <Result
        img={<CustomIcon type={getIcon()} className="icon" />}
        title="支付成功"
        message={<div><div style={{ fontSize: '0.72rem', color: '#000', lineHeight: 1 }}>29.00</div><del>33元</del></div>}
      />
      <WhiteSpace />
    </div>
  );
}

SuccessPage.propTypes = {
};

export default connect()(SuccessPage);
